#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main() {
    int n = 0;
    scanf("%d", &n);
    int arr1[n][n];
    int x = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            scanf("%d", &arr1[i][j]);
            if (x == 0 && i >= 1 && j < i)
            {
                if (arr1[i][j] != 0)
                {
                    x = 1;
                    i = n;
                    break;
                }
            }
        }
    }
    if (x == 0)
    {
        printf("YES");
    }
    else
    {
        printf("NO");
    }

    return 0;
}